package com.ruoyi.common.core.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.entity.SysUser;
import org.babyfish.jimmer.sql.*;
import org.springframework.lang.Nullable;

import java.time.LocalDateTime;

/**
 * Entity基类
 *
 * @author ruoyi
 */
@MappedSuperclass
public interface BaseEntity {


    /**
     * 创建者
     */
    @Nullable
    @ManyToOne
    @OnDissociate(DissociateAction.SET_NULL)
    @JoinColumn(name = "create_by")
    SysUser createBy();

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Nullable
    LocalDateTime createTime();

    /**
     * 更新者
     */
    @Nullable
    @ManyToOne
    @OnDissociate(DissociateAction.SET_NULL)
    @JoinColumn(name = "update_by")
    SysUser updateBy();

    /**
     * 更新时间
     */
    @Nullable
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    LocalDateTime updateTime();

    /**
     * 备注
     */
    @Nullable
    String remark();

}
